package com.chenxiao.Memento;

/**
 * @Author: CX
 * @Date: Created in  2024/04/03 11:36
 * @version: v1.0
 * @Description: TODO 发起人角色
 **/
public class Originator {
    private String state;
    public void setState(String state) {
        this.state = state;
    }

    public String getState() {
        return state;
    }
    public Memento saveStateToMemento() {
        return new Memento(state);
    }

    public void restoreStateFromMemento(Memento memento) {
        state = memento.getState();
    }
    public Memento createMemento() {
        return new Memento(state);
    }

    public void restoreMemento(Memento memento) {
        state = memento.getState();
    }
}
